﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.RenderQueueRange
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Describes a material render queue range.</para>
  /// </summary>
  public struct RenderQueueRange : IEquatable<RenderQueueRange>
  {
    private int m_LowerBound;
    private int m_UpperBound;
    private const int k_MinimumBound = 0;
    /// <summary>
    ///   <para>Minimum value that can be used as a bound.</para>
    /// </summary>
    public static readonly int minimumBound = 0;
    private const int k_MaximumBound = 5000;
    /// <summary>
    ///   <para>Maximum value that can be used as a bound.</para>
    /// </summary>
    public static readonly int maximumBound = 5000;

    /// <summary>
    ///   <para>Create a render queue range struct.</para>
    /// </summary>
    /// <param name="lowerBound">Inclusive lower bound for the range.</param>
    /// <param name="upperBound">Inclusive upper bound for the range.</param>
    public RenderQueueRange(int lowerBound, int upperBound)
    {
      if (lowerBound < 0 || lowerBound > 5000)
        throw new ArgumentOutOfRangeException(nameof (lowerBound), (object) lowerBound, string.Format("The lower bound must be at least {0} and at most {1}.", (object) 0, (object) 5000));
      if (upperBound < 0 || upperBound > 5000)
        throw new ArgumentOutOfRangeException(nameof (upperBound), (object) upperBound, string.Format("The upper bound must be at least {0} and at most {1}.", (object) 0, (object) 5000));
      this.m_LowerBound = lowerBound;
      this.m_UpperBound = upperBound;
    }

    /// <summary>
    ///   <para>A range that includes all objects.</para>
    /// </summary>
    public static RenderQueueRange all
    {
      get
      {
        return new RenderQueueRange()
        {
          m_LowerBound = 0,
          m_UpperBound = 5000
        };
      }
    }

    /// <summary>
    ///   <para>A range that includes only opaque objects.</para>
    /// </summary>
    public static RenderQueueRange opaque
    {
      get
      {
        return new RenderQueueRange()
        {
          m_LowerBound = 0,
          m_UpperBound = 2500
        };
      }
    }

    /// <summary>
    ///   <para>A range that includes only transparent objects.</para>
    /// </summary>
    public static RenderQueueRange transparent
    {
      get
      {
        return new RenderQueueRange()
        {
          m_LowerBound = 2501,
          m_UpperBound = 5000
        };
      }
    }

    /// <summary>
    ///   <para>Inclusive lower bound for the range.</para>
    /// </summary>
    public int lowerBound
    {
      get => this.m_LowerBound;
      set
      {
        this.m_LowerBound = value >= 0 && value <= 5000 ? value : throw new ArgumentOutOfRangeException(string.Format("The lower bound must be at least {0} and at most {1}.", (object) 0, (object) 5000));
      }
    }

    /// <summary>
    ///   <para>Inclusive upper bound for the range.</para>
    /// </summary>
    public int upperBound
    {
      get => this.m_UpperBound;
      set
      {
        this.m_UpperBound = value >= 0 && value <= 5000 ? value : throw new ArgumentOutOfRangeException(string.Format("The upper bound must be at least {0} and at most {1}.", (object) 0, (object) 5000));
      }
    }

    public bool Equals(RenderQueueRange other)
    {
      return this.m_LowerBound == other.m_LowerBound && this.m_UpperBound == other.m_UpperBound;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is RenderQueueRange other && this.Equals(other);
    }

    public override int GetHashCode() => this.m_LowerBound * 397 ^ this.m_UpperBound;

    public static bool operator ==(RenderQueueRange left, RenderQueueRange right)
    {
      return left.Equals(right);
    }

    public static bool operator !=(RenderQueueRange left, RenderQueueRange right)
    {
      return !left.Equals(right);
    }
  }
}
